﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using System.Security.Cryptography.X509Certificates;

namespace NHINDirect
{
    /// <summary>
    /// Used when an entire organization is represented by the same organization certificate
    /// </summary>
    public class UniformCertificateStore : ICertificateStore
    {
        X509Certificate2 m_cert;

        public UniformCertificateStore(X509Certificate2 cert)
        {
            this.Certificate = cert;
        }

        public virtual X509Certificate2 Certificate
        {
            get
            {
                return this.m_cert;
            }
            set
            {
                if (value == null)
                {
                    throw new ArgumentNullException();
                }

                this.m_cert = value;
            }
        }

        public X509Certificate2 GetCertificate(MailAddress address)
        {
            if (address == null)
            {
                throw new ArgumentNullException();
            }

            return this.m_cert;
        }
    }
}
